#include "shm.hpp"
#include "namedpipe.hpp"

int main()
{
    Namedpipe npipe(PATH, PIPE_NAME, MODE_DEFAULT);
    FileOper fp(PATH, PIPE_NAME);
    fp.OpenForRead();

    Shm shm(PATH_NAME, PROJ_ID, "server");
    shm.Attach();
    printf("%p\n", shm.Virtualaddr());

    char *addr = (char *)shm.Virtualaddr();
    while (true)
    {
        if (fp.Wait())
        {
            printf("%s\n", addr);
        }
        else
            break;
    }
    shm.Detach();

    fp.Close();

    return 0;
}